<%--                                                                       --%>
<%-- Copyright (c) 2003-2005 BroadVision, Inc.  All rights reserved.       --%>
<%--                                                                       --%>
<%-- This software is copyrighted. Under the copyright laws, this software --%>
<%-- may not be copied, in whole or in part, without prior written consent --%>
<%-- of BroadVision, Inc. or its assignees. This software is provided      --%>
<%-- under the terms of a license between BroadVision and the recipient,   --%>
<%-- and its use is subject to the terms of that license.                  --%>
<%--                                                                       --%>
<%-- This software may be protected by one or more U.S. and International  --%>
<%-- patents.  Certain applications of BroadVision One-To-One software are --%>
<%-- covered by U.S. patent 5,710,887.                                     --%>
<%--                                                                       --%>
<%-- TRADEMARKS: BroadVision and BroadVision One-To-One are registered     --%>
<%-- trademarks of BroadVision, Inc., in the United States and the         --%>
<%-- European Community, and are trademarks of BroadVision, Inc., in other --%>
<%-- countries.  The BroadVision logo, is a trademark of BroadVision,      --%>
<%-- Inc., in the United States and other countries. Additionally, IONA    --%>
<%-- and Orbix are trademarks of IONA Technologies, Ltd.  RSA, MD5, and    --%>
<%-- RC2 are trademarks of RSA Data Security, Inc.                         --%>
<%--                                                                       --%>

<%@ page import="java.util.Map" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="com.broadvision.ssp.client.SspInstance" %>
<%@ page import="com.broadvision.process.tools.action.process.ProcessList" %>

<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el" %>
<%@ taglib uri="/WEB-INF/struts-bean-el.tld" prefix="bean-el" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/bv-html.tld" prefix="bvhtml" %>

<% String ctxPath = request.getContextPath(); %>

<jsp:useBean id="bpProcessInstanceSearchForm" 
          class="com.broadvision.process.tools.action.process.ProcessInstanceSearchForm"
          scope ="session"/>

<script language="JavaScript" src="<%= ctxPath %>/mt/js/date.js"></script>
<script language="JavaScript" src="<%= ctxPath %>/bp/js/user_popup_funcs.js"></script>
<script language="JavaScript">
 function selectOverdue(myform) {
  with (myform) {
    includeDueDateEnd.checked=true;
    includeDueDateStart.checked=false;
    if ( sspInstanceStatus == null ) 
        return true;
    if ( sspInstanceStatus.length == null ) {
        sspInstanceStatus.checked = false;
        return true;
    }
    for (i = 0; i < sspInstanceStatus.length; i++)
        sspInstanceStatus[i].checked = false;
    sspInstanceStatus[0].checked = true;
    sspInstanceStatus[1].checked = true;
    var now = new Date();
    elements["dueDateEnd.month"].value=now.getMonth();
    elements["dueDateEnd.day"].value=now.getDate();
    elements["dueDateEnd.year"].value=now.getYear();
    return true;
  }
 }
 
 function acl(myform) {
  with (myform) {
   if (sspManager.options.selectedIndex==sspManager.options.length-1)
    sspInstanceManager.options[0].selected = true;
  }
 }
 
 function acl2(myform) {
  with (myform) {
   if (sspInstanceManager.options.selectedIndex==sspInstanceManager.options.length-1)
    sspManager.options[0].selected = true;
  }
 }
 
function setUserAlias(formName, fieldName, fieldValue) {
  // this page does not have any hidden fields that rely on the popup,
  // we do not need a refresh url.
  var refreshUrl = null;
  setFieldValue(refreshUrl, formName, fieldName, fieldValue);
}

//
//
//
function validateForm(myform, formname) {
  var dateLaunchDateStart = getDateOnly(formname, "launchDateStart");
  var dateLaunchDateEnd = getDateOnly(formname, "launchDateEnd");
  var dateDueDateStart = getDateOnly(formname, "dueDateStart");
  var dateDueDateEnd = getDateOnly(formname, "dueDateEnd");
  if (myform.includeLaunchDateStart.checked) {
    if (null == dateLaunchDateStart) {
      alert('<bean-el:message key="bp.process.processInstanceSearch.error.launchDateStart" bundle="bp.messages"/>');
      return false;
    }
  }
  if (myform.includeLaunchDateEnd.checked) {
    if (null == dateLaunchDateEnd) {
      alert('<bean-el:message key="bp.process.processInstanceSearch.error.launchDateEnd" bundle="bp.messages"/>');
      return false;
    }
  }
  if (myform.includeLaunchDateStart.checked && myform.includeLaunchDateEnd.checked &&
    dateLaunchDateStart > dateLaunchDateEnd) {
    alert('<bean-el:message key="bp.process.processInstanceSearch.error.launchDateStartLaterThanEnd" bundle="bp.messages"/>');
    return false;
  }
  if (myform.includeDueDateStart.checked) {
    if (null == dateDueDateStart) {
      alert('<bean-el:message key="bp.process.processInstanceSearch.error.dueDateStart" bundle="bp.messages"/>');
      return false;
    }
  }
  if (myform.includeDueDateEnd.checked) {
    if (null == dateDueDateEnd) {
      alert('<bean-el:message key="bp.process.processInstanceSearch.error.dueDateEnd" bundle="bp.messages"/>');
      return false;
    }
  }
  if (myform.includeDueDateStart.checked && myform.includeDueDateEnd.checked &&
    dateDueDateStart > dateDueDateEnd) {
    alert('<bean-el:message key="bp.process.processInstanceSearch.error.dueDateStartLaterThanEnd" bundle="bp.messages"/>');
    return false;
  }
  return true;
}
function onSubmit(myform, formname) {
  if (!validateForm(myform, formname)) return false;

  myform.pageSegment.value=0;
  myform.searchResultMsg.value = 'ShowResults';
  return true;
}
function goPage(myform, formname) {
  myform.searchResultMsg.value = 'ShowResultsFromCache';
  myform.submit();
  return true;
}
function hidePagination () {
document.bpProcessInstanceSearchForm.limitPerPage.style.visibility='hidden';
document.getElementById("rowsPerPage").style.visibility = 'hidden';
if (document.getElementById('pagination'))
document.getElementById('pagination').style.visibility = 'hidden'; 
}
</script>

<c:set var="editImg">
<img src="<%= ctxPath %>/mc/images/action/icon_edit.gif" width="15" height="15" border="0" class="actionIcon" alt="<bean-el:message key="image.alt.edit" bundle="mc.messages"/>" title="<bean-el:message key="image.alt.edit" bundle="mc.messages"/>">
</c:set>
<c:set var="outlineImg">
<img src="<%= ctxPath %>/bp/images/action/icon_viewsteps.gif" width="15" height="15" border="0" class="actionIcon" alt="<bean-el:message key="bp.process.processInstanceSearch.icon.outline" bundle="bp.messages"/>" title="<bean-el:message key="bp.process.processInstanceSearch.icon.outline" bundle="bp.messages"/>"/>
</c:set>
<c:set var="diagramImg">
<img src="<%= ctxPath %>/bp/images/action/icon_diagram.gif" width="15" height="15" border="0" class="actionIcon" alt="<bean-el:message key="bp.process.processInstanceSearch.icon.diagram" bundle="bp.messages"/>" title="<bean-el:message key="bp.process.processInstanceSearch.icon.diagram" bundle="bp.messages"/>"/>
</c:set>

<html-el:form action="/bp/processInstanceSearch.do?action=search" focus="sspName">
<!--start zone 5 content area-->
    <table class="zoneFive" width="100%" border="0" cellspacing="0" cellpadding="0" summary="<bean-el:message key="bp.process.processInstance.contentArea" bundle="bp.messages"/>">
    <tr> 
		    <td valign="top" width="100%">
		      <div class="pageTitle"><bean-el:message key="bp.process.processInstanceSearch.title" bundle="bp.messages"/><logic:match name="bpProcessInstanceSearchForm" 
                    property="searchResultMsg" 
                    value="ShowResults">                       
            : <c:out value="${bpProcessInstanceSearchForm.resultSize}"/>
            <bean-el:message key="bp.process.processInstanceSearch.found" bundle="bp.messages"/>
          </logic:match></div>
          <div class="errorMessage"><html-el:errors bundle="bp.messages"/></div>
          <div class="pageSubtitle">
            <span class="left"><bean-el:message key="bp.process.processInstanceSearch.searchCriteria" bundle="bp.messages"/></span>
          </div> 
          <table class="labelForm" width="100%" border="0" cellspacing="0" cellpadding="0" summary="<bean-el:message key="bp.process.processInstanceSearch.summary" bundle="bp.messages"/>">
         
		 <!--start main content here-->

        <tr><td valign="top" width="20%" 
                class="label"> <bean-el:message key="bp.process.processInstanceSearch.processName" bundle="bp.messages"/> </td>
            <td valign="top" class="labelField" width="80%" colspan="2">
                 
             <html-el:text  name="bpProcessInstanceSearchForm" 
                            property="sspName" 
                            size="31" maxlength="80"/>
            <!--html-el:select  name ="bpProcessInstanceSearchForm"
                          property = "sspName" size="1"-->
            <!--html-el:options
                name="com.broadvision.process.tools.action.process.ProcessList" 
                property="processNames" /-->
            <!--/html-el:select-->
            </td>
        </tr>
        <% if (bpProcessInstanceSearchForm.getMyDelegators() != null) { %>
        <tr><td valign="top" wrap width="20%" 
                class="label"> <bean-el:message key="bp.process.processInstanceSearch.processManager" bundle="bp.messages"/></td>
            <td valign="top" class="labelField" width="80%" colspan="2">
            <html-el:select  name ="bpProcessInstanceSearchForm"
                          property = "sspManager" size="1" onchange="javascript:acl(this.form);">
            <html-el:options
                name="bpProcessInstanceSearchForm" 
                property="myDelegators" />
            </html-el:select>
            </td>
        </tr>
        <tr><td valign="top" wrap width="20%" 
                class="label"> <bean-el:message key="bp.process.processInstanceSearch.instanceManager" bundle="bp.messages"/> </td>
            <td valign="top" class="labelField" width="80%" colspan="2">
            <html-el:select  name ="bpProcessInstanceSearchForm"
                          property = "sspInstanceManager" size="1" onchange="javascript:acl2(this.form);">
            <html-el:options
                name="bpProcessInstanceSearchForm" 
                property="myDelegators" />
            </html-el:select>
            </td>
        </tr>
        <%} else { %>
        
        <tr><td valign="top" wrap width="20%" 
                class="label"> <bean-el:message key="bp.process.processInstanceSearch.processManager" bundle="bp.messages"/></td>
            <td valign="top" class="labelField" width="80%" colspan="2">
               <html-el:text  name="bpProcessInstanceSearchForm" 
                            property="sspManager" 
                            size="31" maxlength="80"/>
               <input type="button" name="browseUsers" class="pageButton"
              onClick="JavaScript:findUserPopup('<html-el:rewrite page="/mt/userSearchPopup.do"/>', 'bpProcessInstanceSearchForm', 'sspManager')"
              value='<bean-el:message key="button.browse" bundle="bp.messages"/>'>
            </td>
        </tr>
        <tr><td valign="top" wrap width="20%" 
                class="label"> <bean-el:message key="bp.process.processInstanceSearch.instanceManager" bundle="bp.messages"/> </td>
            <td valign="top" class="labelField" width="80%" colspan="2">
                <html-el:text  name="bpProcessInstanceSearchForm" 
                            property="sspInstanceManager" 
                            size="31" maxlength="80"/>
               <input type="button" name="browseUsers" class="pageButton"
              onClick="JavaScript:findUserPopup('<html-el:rewrite page="/mt/userSearchPopup.do"/>', 'bpProcessInstanceSearchForm', 'sspInstanceManager')"
              value='<bean-el:message key="button.browse" bundle="bp.messages"/>'>
            </td>
        </tr>

    <% } %>        
        
        
        <tr><td valign="top" wrap width="20%" 
                class="label"> <bean-el:message key="bp.process.processInstanceSearch.launchUser" bundle="bp.messages"/></td>
            <td valign="top" class="labelField" width="80%" colspan="2">
                <html-el:text  name="bpProcessInstanceSearchForm" 
                            property="launchUser" 
                            size="31" maxlength="80"/>
               <input type="button" name="browseUsers" class="pageButton"
              onClick="JavaScript:findUserPopup('<html-el:rewrite page="/mt/userSearchPopup.do"/>', 'bpProcessInstanceSearchForm', 'launchUser')"
              value='<bean-el:message key="button.browse" bundle="bp.messages"/>'>
            </td>
        </tr>
        <tr><td valign="top" wrap width="20%" 
                class="label"> <bean-el:message key="bp.process.processInstanceSearch.participant" bundle="bp.messages"/></td>
            <td valign="top" class="labelField" width="80%" colspan="2">
                <html-el:text  name="bpProcessInstanceSearchForm" 
                            property="participant" 
                            size="31" maxlength="80" onclick="javascript:hidePagination();" />
               <input type="button" name="browseUsers" class="pageButton"
              onClick="JavaScript:findUserPopup('<html-el:rewrite page="/mt/userSearchPopup.do"/>', 'bpProcessInstanceSearchForm', 'participant')"
              value='<bean-el:message key="button.browse" bundle="bp.messages"/>'>
            </td>
        </tr>
        <tr><td valign="top" wrap width="20%" 
                class="label"> <bean-el:message key="bp.process.processInstanceSearch.instanceName" bundle="bp.messages"/></td>
            <td valign="top" class="labelField" width="80%" colspan="2">
                <html-el:text  name="bpProcessInstanceSearchForm" 
                            property="instanceName" 
                            size="31" maxlength="80"/>
            </td>
        </tr>
        <tr>
            <td valign="middle" width="20%" class="label">&nbsp;</td>
            <td valign="middle" width="80%" class="labelField" colspan="2"><input type="button" name="overdue" class="inputButton"  onClick="selectOverdue(this.form);"
                value="<bean-el:message key="bp.process.processInstanceSearch.overdue" bundle="bp.messages"/>">
			</td>	
        </tr>    

        <tr><td valign="top" wrap width="20%" 
                class="label"> <bean-el:message key="bp.process.processInstanceSearch.status" bundle="bp.messages"/></td>
            <td valign="top" class="labelField" width="80%" colspan="2">
                
    <%
    ProcessList pl = (ProcessList)
    session.getAttribute("com.broadvision.process.tools.action.process.ProcessList");
    String[] states = pl.getProcessInstanceStatesAsArray();
    %>
		 <logic:iterate name="com.broadvision.process.tools.action.process.ProcessList" property="processInstanceStateValues" id="stateValue" indexId="i">
                <html-el:multibox 
                property="sspInstanceStatus" >
                <c:out value="${stateValue}" />
                </html-el:multibox>
                <%= states[i.intValue()] %>
        </logic:iterate>
            </td>
        </tr>
        <tr>
            <td valign="middle" width="20%" class="label"><bean-el:message key="bp.process.processInstanceSearch.includeLaunchDate" bundle="bp.messages"/></td>
            <td valign="middle" class="labelField" width="10%" nowrap>  
                  <html-el:checkbox property="includeLaunchDateStart"/>
                  <bean-el:message key="bp.process.processInstanceSearch.launchDateStart" bundle="bp.messages"/>
		    </td>
			<td valign="middle" class="labelField" width="70%" nowrap>
                    <bvhtml:date name="bpProcessInstanceSearchForm" 
                             property="launchDateStart"
                        onChangeMonth="onChangeMonth"
                         onChangeYear="onChangeYear"/>
                    <a href="JavaScript:datePopup(
                        '<html-el:rewrite page="/mt/calendar.do"/>',
                        'bpProcessInstanceSearchForm','launchDateStart')">
                        <img src="<%= ctxPath %>/mc/images/action/calendar.gif" 
                            width="22" 
                            height="22" 
                            alt="<bean-el:message key="bp.process.processInstanceSearch.chooseDate"  bundle="bp.messages"/>" 
                            border="0" 	
                            align="absmiddle"/></a>
		</tr>					
        <tr>
          <td valign="middle" width="20%" class="label">&nbsp;</td>
          <td valign="middle" class="labelField" width="10%" nowrap>       
				  <html-el:checkbox property="includeLaunchDateEnd"/>
                  <bean-el:message key="bp.process.processInstanceSearch.launchDateEnd" bundle="bp.messages"/>
          </td>
		  <td valign="middle" class="labelField" width="70%" nowrap>        
		    <bvhtml:date name="bpProcessInstanceSearchForm" 
                             property="launchDateEnd"
                        onChangeMonth="onChangeMonth"
                         onChangeYear="onChangeYear"/>
                    <a href="JavaScript:datePopup(
                        '<html-el:rewrite page="/mt/calendar.do"/>',
                        'bpProcessInstanceSearchForm','launchDateEnd')">
                        <img src="<%= ctxPath %>/mc/images/action/calendar.gif" 
                            width="22" 
                            height="22" 
                            alt="<bean-el:message key="bp.process.processInstanceSearch.chooseDate"  bundle="bp.messages"/>" 
                            border="0" 	
                            align="absmiddle"/>
                    </a>
				  
				  
            </td>
        </tr>
        <tr>
            <td valign="middle" width="20%" class="label"><bean-el:message key="bp.process.processInstanceSearch.includeDueDate" bundle="bp.messages"/></td>
            <td valign="middle" width="10%" class="labelField" nowrap>    
			     <html-el:checkbox property="includeDueDateStart"/>
                 <bean-el:message key="bp.process.processInstanceSearch.dueDateStart" bundle="bp.messages"/>
			</td>
			<td valign="middle" width="70%" class="labelField" nowrap>	 
                 <bvhtml:date name="bpProcessInstanceSearchForm" 
                          property="dueDateStart"
                     onChangeMonth="onChangeMonth"
                      onChangeYear="onChangeYear"/>
                    <a href="JavaScript:datePopup(
                        '<html-el:rewrite page="/mt/calendar.do"/>',
                        'bpProcessInstanceSearchForm','dueDateStart')">
                        <img src="<%= ctxPath %>/mc/images/action/calendar.gif" 
                            width="22" 
                            height="22" 
                            alt="<bean-el:message key="bp.process.processInstanceSearch.chooseDate"  bundle="bp.messages"/>" 
                            border="0" 	
                            align="absmiddle"/></a>
            </td>
		  </tr>
		  <tr>
            <td valign="middle" width="20%" class="label">&nbsp;</td>
            <td valign="middle" width="10%" class="labelField" nowrap>  	      
				  <html-el:checkbox property="includeDueDateEnd"/>
        <bean-el:message key="bp.process.processInstanceSearch.dueDateEnd" bundle="bp.messages"/>
		    </td>
			<td valign="middle" width="70%" class="labelField" nowrap>	
                    <bvhtml:date name="bpProcessInstanceSearchForm" 
                             property="dueDateEnd"
                        onChangeMonth="onChangeMonth"
                         onChangeYear="onChangeYear"/>
                    <a href="JavaScript:datePopup(
                        '<html-el:rewrite page="/mt/calendar.do"/>',
                        'bpProcessInstanceSearchForm','dueDateEnd')">
                        <img src="<%= ctxPath %>/mc/images/action/calendar.gif" 
                            width="22" 
                            height="22" 
                            alt="<bean-el:message key="bp.process.processInstanceSearch.chooseDate"  bundle="bp.messages"/>" 
                            border="0" 	
                            align="absmiddle"/>
                    </a>
				  
            </td>
        </tr>
        <tr> 
            <td valign="top" width="20%" class="label"><bean-el:message key="bp.process.processInstanceSearch.sortby" bundle="bp.messages"/></td>
            <td valign="top" class="labelField" width="80%" colspan="2"> 
            <html-el:select name ="bpProcessInstanceSearchForm" 
                         property = "sortBy" size="1">
                <html-el:option value = ""><bean-el:message key="bp.process.processInstanceSearch.option.nosort" bundle="bp.messages"/></html-el:option>
                <html-el:option value = "INSTANCE_NAME"><bean-el:message key="bp.process.processInstanceSearch.option.instanceName" bundle="bp.messages"/> </html-el:option>
                <html-el:option value = "LAUNCH_USER"><bean-el:message key="bp.process.processInstanceSearch.option.launchUser" bundle="bp.messages"/></html-el:option>
                <html-el:option value = "CREATION_TIME"><bean-el:message key="bp.process.processInstanceSearch.option.launchDate" bundle="bp.messages"/></html-el:option>
                <html-el:option value = "DUE_DATE"><bean-el:message key="bp.process.processInstanceSearch.option.dueDate" bundle="bp.messages"/></html-el:option>
                <html-el:option value = "STATE"><bean-el:message key="bp.process.processInstanceSearch.option.state" bundle="bp.messages"/></html-el:option>
            </html-el:select>
           &nbsp; &nbsp;<span id="rowsPerPage" class="label"><bean-el:message key="bp.process.processInstanceSearch.rows" bundle="bp.messages"/></span>
<html-el:select name ="bpProcessInstanceSearchForm"
            property = "limitPerPage" size="1">
          <html-el:option value="10">10</html-el:option>
          <html-el:option value="20">20</html-el:option>
          <html-el:option value="30">30</html-el:option>
          <html-el:option value="50">50</html-el:option>
          <html-el:option value="100">100</html-el:option>
            </html-el:select>
            </td>
        </tr>
      </table>
	  <div class="pageButtonWrap" align="right">
	        <html-el:hidden property="searchResultMsg" />
	        <html-el:hidden property="pageSegment" />
			<input type="submit" name="results" class="inputButton"  onClick="return onSubmit(this.form, 'bpProcessInstanceSearchForm')"
                value="<bean-el:message key="button.showResults" bundle="bp.messages"/>">
      </div>  
      
	  <br>
	  
     <logic:match name="bpProcessInstanceSearchForm" property="searchResultMsg" 
                  value="ShowResults">
<!--start subtitle row-->
    <div class="pageSubtitle">
    <span class="left">
    <bean-el:message key="bp.process.processInstanceSearch.searchResult" bundle="bp.messages"/>
    <c:out value="${bpProcessInstanceSearchForm.resultSize}"/>
    <bean-el:message key="bp.process.processInstanceSearch.instance" bundle="bp.messages"/></span><span class="right">&nbsp;</span>
    </div>

<!--end subtitle row-->
<!-- Start subtitle buttons row -->
        <logic:greaterThan name="bpProcessInstanceSearchForm"
                               property="resultSize" value="0">

<!-- End subtitle buttons row -->
        
            <!-- Start List here -->
              
             <table class="dataTable" border="0" cellspacing="1" cellpadding="2" summary="Search result table" width="100%">
		      <tr class="listHeader">  
                <th valign="top" id="processName" align="left"><bean-el:message key="bp.process.processInstanceSearch.option.instanceName" bundle="bp.messages"/></th>
                <th valign="top" id="launchUser"  align="left"><bean-el:message key="bp.process.processInstanceSearch.option.launchUser" bundle="bp.messages"/></th>
                <th valign="top" id="launchDate"  align="left"><bean-el:message key="bp.process.processInstanceSearch.option.launchDate" bundle="bp.messages"/></th>
                <th valign="top" id="dueDate" align="left"><bean-el:message key="bp.process.processInstanceSearch.option.dueDate" bundle="bp.messages"/></th>
                <th valign="top" id="status" align="left"><bean-el:message key="bp.process.processInstanceSearch.text.status" bundle="bp.messages"/></th>
                <th valign="top" id="actions" align="left" nowrap><bean-el:message key="bp.process.processInstanceSearch.action" bundle="bp.messages"/></th>
              </tr>
              <%  
                SspInstance[] sspis =
                    bpProcessInstanceSearchForm.getSearchResults();
                for (int i = 0; i < sspis.length; i++) {
                 SspInstance sspi = sspis[i]; 
                 Map dates = new HashMap();
                 dates.put("beginDate", sspi.getColumnDate("CREATION_TIME"));
                 dates.put("dueDate", sspi.getDueDate());
                 
                 pageContext.setAttribute("dates", dates);             
                 if ( ( i % 2 ) == 0 ) { %>
                    <tr class="listEven"> 
              <% } else { %>
              <tr class="listOdd">
              <% } %>
                  <td valign="top"  headers="processName">
                    <a href="<%= response.encodeURL( ctxPath + "/bp/processInstance.do?instanceOid="+ sspi.getOid())%>" ><%= sspi.getCustomId() %></a>
                  </td>
                  <td valign="top"  headers="launchUser">
                    <%= sspi.getLaunchUser() %>
                  </td>
                  <td valign="top" headers="launchDate"><bean:write name="dates" property="beginDate" formatKey="format.datetime.short" bundle="mc.messages"/>
                  </td>
                  <td valign="top" headers="dueDate"><bean:write name="dates" property="dueDate" formatKey="format.datetime.short" bundle="mc.messages"/></td>
                  <td valign="top" headers="status">
                    <bean-el:message key="<%=\"bp.process.processInstance.state.\"+ sspi.getState().getIntCode() %>" bundle="bp.messages"/></td>
                  <td valign="top" nowrap align="left" 
                    headers="actions">

                <% if (sspi.getState().getIntCode() < 2) { %>
                <a href="<%= response.encodeURL( ctxPath + "/bp/processInstance.do?action=edit&instanceOid="+ sspi.getOid())%>"><c:out value='${editImg}' escapeXml="false"/></a>
                <% } %>
                <a href="<%= response.encodeURL( ctxPath + "/bp/processInstanceTasks.do?instanceOid="+ sspi.getOid())%>"><c:out value='${outlineImg}' escapeXml="false"/></a>
                <a href="<%= response.encodeURL( ctxPath + "/bp/processInstanceDiagram.do?instanceOid="+ sspi.getOid())%>"><c:out value='${diagramImg}' escapeXml="false"/></a>
                </td>
              </tr>
<!--end list here-->
           <% } // end of loop %>
            </table>
            <div id="pagination" class="pagination">
             <logic:greaterThan name="bpProcessInstanceSearchForm" property="maxSegment" value="0">
		      <a href="#" class="paginationBtn" onclick="javascript:bpProcessInstanceSearchForm.pageSegment.value=0;return goPage(document.forms['bpProcessInstanceSearchForm'], 'bpProcessInstanceSearchForm')"><bean-el:message key="bp.process.processInstanceSearch.first" bundle="bp.messages"/></a> <a href="#" class="paginationBtn" onclick="javascript:if (bpProcessInstanceSearchForm.pageSegment.value>0)bpProcessInstanceSearchForm.pageSegment.value--;return goPage(document.forms['bpProcessInstanceSearchForm'], 'bpProcessInstanceSearchForm')">&lt;</a></logic:greaterThan> <bean-el:message key="bp.process.processInstanceSearch.page" bundle="bp.messages"/> <b><%= bpProcessInstanceSearchForm.getPageSegment()+1%>
 </b> <bean-el:message key="bp.process.processInstanceSearch.of" bundle="bp.messages"/> <%= bpProcessInstanceSearchForm.getMaxSegment()+1%> <logic:greaterThan name="bpProcessInstanceSearchForm" property="maxSegment" value="0"><a href="#" class="paginationBtn" onclick="javascript:if (bpProcessInstanceSearchForm.pageSegment.value<<%=bpProcessInstanceSearchForm.getMaxSegment()%>) bpProcessInstanceSearchForm.pageSegment.value++;return goPage(document.forms['bpProcessInstanceSearchForm'], 'bpProcessInstanceSearchForm')">&gt;</a> <a href="#" class="paginationBtn" onclick="javascript:bpProcessInstanceSearchForm.pageSegment.value=<%=bpProcessInstanceSearchForm.getMaxSegment()%>;return goPage(document.forms['bpProcessInstanceSearchForm'], 'bpProcessInstanceSearchForm')"><bean-el:message key="bp.process.processInstanceSearch.last" bundle="bp.messages"/></a></logic:greaterThan>
			</div>
           </logic:greaterThan>
           <% if (bpProcessInstanceSearchForm.getResultSize()<=0) { %>
            <table class="dataTable" border="0" cellspacing="1" cellpadding="2" summary="Search result table" width="100%">
		      <tr class="listHeader">  
                <th valign="top" id="processName" align="left"><bean-el:message key="bp.process.processInstanceSearch.option.instanceName" bundle="bp.messages"/></th>
                <th valign="top" id="launchUser"  align="left"><bean-el:message key="bp.process.processInstanceSearch.option.launchUser" bundle="bp.messages"/></th>
                <th valign="top" id="launchDate"  align="left"><bean-el:message key="bp.process.processInstanceSearch.option.launchDate" bundle="bp.messages"/></th>
                <th valign="top" id="dueDate" align="left"><bean-el:message key="bp.process.processInstanceSearch.option.dueDate" bundle="bp.messages"/></th>
                <th valign="top" id="status" align="left"><bean-el:message key="bp.process.processInstanceSearch.text.status" bundle="bp.messages"/></th>
                <th valign="top" id="actions" align="left" nowrap><bean-el:message key="bp.process.processInstanceSearch.action" bundle="bp.messages"/></th>
              </tr>
               <tr class="listEven"> 
                  <td colspan="6" valign="top" align="center"><bean-el:message key="bp.process.processInstanceSearch.nofound" bundle="bp.messages"/>
                  </td>
               </tr>
            </table>
           <% } %>
          
      </logic:match>
     
    </td>
  </tr>
</table>

<!--end main content area here-->
<!--end zone 5 content area-->

</html-el:form>

<script>
var parti = document.bpProcessInstanceSearchForm.participant;
if (parti!=null && parti.value != "") {hidePagination ();}
</script>

